import DefaultTable from "@/components/DefaultTable";
import SearchForm from "@/components/SearchForm";
import { getBreadcRumb } from "@/utils/util";
import { ColumnsType } from 'antd/es/table'
import { useEffect, useRef, useState } from "react";
import format from 'dayjs';
function LogManage() {
    getBreadcRumb([{ name: "下单列表" }])
    const TableRef = useRef<TableRefParams>(null)
    const [values, setvalues] = useState({})
    const columns: ColumnsType<BaselistItem> = [
        {
            title: "序号",
            dataIndex: "itemSn",
            render: (_text, record, index) => (((record.pageNum || 0) - 1) * (record.pageSize || 0) + index + 1)
        },
        {
            title: "创建时间",
            dataIndex: "createTime",
            render: (text) => text && format(text).format("YYYY-MM-DD HH:mm:ss")
        },
        {
            title: "老板名称",
            dataIndex: "bossName",
        },
        {
            title: "陪玩名称",
            dataIndex: "playWiths",
        },
        {
            title: "消费时间",
            dataIndex: "orderTime",
        },
        {
            title: "消费金额",
            dataIndex: "price",
        },
        {
            title: "剩余金额",
            dataIndex: "amount",
        },
    ]
    const searchList: listItem[] = [
        {
            label: "老板名称",
            name: "bossName",
            type: "input"
        },
    ]
    function onFinish(values: any) {
        setvalues(values)
    }
    useEffect(() => {
        TableRef.current?.getList()
    }, [values])
    return (
        <div>
            <div className='tableWrap'>
                <SearchForm onFinish={onFinish} list={searchList}></SearchForm>
                <DefaultTable columns={columns} ref={TableRef} api={'/order/list'} values={values} />
            </div>
        </div>
    )
}
export default LogManage;
